#include "BigNum.h"

using namespace std;

/*
 *	helper functions which may need to have the #else of the #ifdef changed based on the Unix implementation
 */

BigNum::pIntArrayType BigNum::BigNum_atoi(const char* Str, char** EndPtr, int Radix)
{
	if (typeid(pIntArrayType) == typeid(unsigned long))
	{
	#ifdef _WIN32
		return strtoul(Str, EndPtr, Radix);
	#else
		return strtoul(Str, EndPtr, Radix);
	#endif
	}
	else if (typeid(pIntArrayType) == typeid(unsigned long long))
	{
	#ifdef _WIN32
		return _strtoui64(Str, EndPtr, Radix);
	#else
		return _strtoui64(Str, EndPtr, Radix);
	#endif
	}
}

char* BigNum::BigNum_itoa(pIntArrayType Value, char* Dest, int Radix)
{
	if (typeid(pIntArrayType) == typeid(unsigned long))
	{
	#ifdef _WIN32
		return _itoa(Value, Dest, Radix);
	#else
		return _itoa(Value, Dest, Radix);
	#endif
	}
	else if (typeid(pIntArrayType) == typeid(unsigned long long))
	{
	#ifdef _WIN32
		return _ui64toa(Value, Dest, Radix);
	#else
		return _ui64toa(Value, Dest, Radix);
	#endif
	}
}